package com.software.zsrt;

import java.io.File;
import java.util.Iterator;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class LoadTest {
	private void load(){
		SAXReader reader=new SAXReader();
		try {
			Document doc=reader.read(new File("e:\\test.txt"));
			Element root=doc.getRootElement();
			for(Iterator<Element> iterator=root.elementIterator();iterator.hasNext();){
				Book book=new Book();
				Element element=iterator.next();
				for(Iterator<Element> iterator2=element.elementIterator();iterator2.hasNext();){
					Element element2=iterator.next();
					if(element2.getName().equals("name")){
					}
				}
			}
		} catch (DocumentException e) {
			e.printStackTrace();
		}
	}
   private void save(){
	   //创建xml文档
	   Document doc=DocumentHelper.createDocument();
	   //添加根节点
	   Element root=doc.addElement("books");
	   //添加集合中所有数据
	 
   }
}
